﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using VPBS.Common;

namespace VPBS.Informix.DAL
{
    public class TctCustomerInformationDAL
    {
        /// <summary>
        /// Lay so dien thoai cua tai khoan khach hang
        /// </summary>
        /// <param name="Custcode"></param>
        /// <returns>PhoneNumber</returns>
        public static string Get_PhoneNumber(string Custcode)
        {
            try
            {
                string command = "select firstfaxno2 from tct where custcode='" + Custcode + "'";

                DataSet ds = InformixOdbcHelper.ExecuteDataset(ConnectStringHelper.InfxOdbcConnectionString, CommandType.Text,
                                                   command);
                if (ds != null && ds.Tables.Count > 0)
                    return ds.Tables[0].Rows[0][0].ToString().Trim();
                return "";
            }
            catch (Exception ex)
            {
                //Logger.Error(typeof(Get_PhoneNumber), ex);
                return "";
            }
        }

        /// <summary>
        /// Lấy thông tin của 1 tài khoản
        /// </summary>
        /// <param name="custcode"></param>
        /// <returns></returns>
        public DataSet Get_AccountInfo(string custcode)
        {
            try
            {
                string command = "select * from tct where custcode='" + custcode + "'";
                return InformixOdbcHelper.ExecuteDataset(ConnectStringHelper.InfxOdbcConnectionString, CommandType.Text,
                                                         command);
            }
            catch
            {
                return null;
            }
        }
    }
}
